package com.heima.user.controller;

import com.alibaba.fastjson.JSON;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.AuthDto;
import com.heima.model.user.pojos.ApUser;
import com.heima.user.service.UseridentifyService;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class UseridentifyController {

    @Autowired
    private UseridentifyService useridentifyService;

    @PostMapping("/auth/list")
    public PageResponseResult list(@RequestBody AuthDto dto) {
        log.info("用户实名认证查询");
        return useridentifyService.pageList(dto);
    }

    @PostMapping("/auth/authFail")
    public ResponseResult authFail(@RequestBody String str) {
        AuthDto dto = JSON.parseObject(str, AuthDto.class);
        log.info("审核失败:{}",dto);
        return useridentifyService.authFail(dto);
    }

    @PostMapping("/auth/authPass")
    public ResponseResult authPass(@RequestBody AuthDto dto) {
        log.info("审核通过");
        return useridentifyService.authPass(dto);
    }



}
